package com.evan.uyclub.GameBa;

import androidx.appcompat.app.AppCompatActivity;

import android.animation.ObjectAnimator;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.graphics.Typeface;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.evan.uyclub.Other.VPNActivity;
import com.evan.uyclub.R;
import com.gyf.immersionbar.BarHide;
import com.gyf.immersionbar.ImmersionBar;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.skydoves.elasticviews.ElasticButton;
import com.skydoves.elasticviews.ElasticImageView;

import butterknife.ButterKnife;

public class Game extends AppCompatActivity {

    String[] UrlData = {"https://www.yikm.net/play?id=4138&n=L2Zjcm9tL3NqL0NvbnRyYSAoKzQgbWVudSkubmVz&t=%E9%AD%82%E6%96%97%E7%BD%97(%E7%BE%8E%E7%89%88)4%E5%90%881&ac=3&p=/fcpic/sj/910a.png",
            "https://www.yikm.net/play?id=3501&n=L2Zjcm9tL2R6bXgvU3VwZXIgTWFyaW8gQnJvcy4gKFcpIFshXS5uZXM=&t=%E8%B6%85%E7%BA%A7%E9%A9%AC%E9%87%8C%E5%A5%A5&ac=3&p=/fcpic/2146a.png",
            "https://www.yikm.net/play?id=3883&n=L2Zjcm9tL2dkL1RlZW5hZ2UgTXV0YW50IE5pbmphIFR1cnRsZXMgLSBUb3VybmFtZW50IEZpZ2h0ZXJzIChVKSBbIV0ubmVz&t=%E6%BF%80%E9%BE%9F%E5%BF%AB%E6%89%93(%E5%BF%8D%E8%80%85%E7%A5%9E%E9%BE%9F%E6%A0%BC%E6%96%97)%E7%BE%8E%E7%89%88&ac=3&p=/fcpic/gd/2259a.png",
            "https://www.yikm.net/play?id=4511&n=L2Zjcm9tL3h5eC9Tbm93IEJyb3MuIChKKS5uZXM=&t=%E9%9B%AA%E4%BA%BA%E5%85%84%E5%BC%9F&ac=3&p=/fcpic/xyx/2023a.png",
            "https://www.yikm.net/play?id=4275&n=L2Zjcm9tL3h5eC9CYXR0bGUgQ2l0eSAoSikgWyFdLm5lcw==&t=%E5%9D%A6%E5%85%8B%E5%A4%A7%E6%88%98&ac=3&p=/fcpic/xyx/timg.png",
            "https://www.yikm.net/play?id=3175&n=L2Zjcm9tL2R6bXgvVGFrYWhhc2hpIE1laWppbiBubyBCb3VrZW4gU2hpbWEgKEopIFshXS5uZXM=&t=%E5%86%92%E9%99%A9%E5%B2%9B&ac=3&p=/fcpic/1001a.png",
            "https://www.yikm.net/play?id=4714&n=L2Zjcm9tL3lkYnMvTmVra2V0c3UgS2FrdXRvdSBEZW5zZXRzdSAoSikgWyFdLm5lcw==&t=%E7%83%AD%E8%A1%80%E6%A0%BC%E6%96%97&ac=3&p=/fcpic/ydbs/1544a.png",
            "https://www.yikm.net/play?id=4713&n=L2Zjcm9tL3lkYnMvSWtlIElrZSEgTmVra2V0c3UgSG9ja2V5LWJ1IC0gU3ViZXR0ZSBLb3JvbmRlIERhaSBSYW50b3UgKEopIFshXS5uZXM=&t=%E7%83%AD%E8%A1%80%E6%9B%B2%E6%A3%8D%E7%90%83&ac=3&p=/fcpic/4713.png",
            "https://www.yikm.net/play?id=4714&n=L2Zjcm9tL3lkYnMvTmVra2V0c3UgS2FrdXRvdSBEZW5zZXRzdSAoSikgWyFdLm5lcw==&t=%E7%83%AD%E8%A1%80%E6%A0%BC%E6%96%97%E4%BC%A0%E8%AF%B4&ac=3&p=/fcpic/ydbs/1544a.png",
            "https://www.yikm.net/play?id=3179&n=L2Zjcm9tL2R6bXgvVGFrYWhhc2hpIE1laWppbiBubyBCb3VrZW4gU2hpbWEgSUlJIChKKSBbIV0ubmVz&t=%E5%86%92%E9%99%A9%E5%B2%9B3(%E6%97%A5%E7%89%88)&ac=3&p=/fcpic/3179.png",
            "https://www.yikm.net/play?id=4717&n=L2Zjcm9tL3lkYnMvUml2ZXIgQ2l0eSBSYW5zb20gKFUpIFshXS5uZXM=&t=%E7%83%AD%E8%A1%80%E7%89%A9%E8%AF%AD(%E7%BE%8E%E7%89%88)&ac=3&p=/fcpic/ydbs/1810a.png",
            "https://www.yikm.net/play?id=4723&n=L2Zjcm9tL3lkYnMvTmludGVuZG8gV29ybGQgQ3VwIChVKSBbIV0ubmVz&t=%E7%83%AD%E8%A1%80%E8%B6%B3%E7%90%83(%E7%BE%8E%E7%89%88)&ac=3&p=/fcpic/ydbs/1587a.png",
            "https://www.yikm.net/play?id=4720&n=L2Zjcm9tL3lkYnMvTmVra2V0c3UhIFN0cmVldCBCYXNrZXQgLSBHYW5iYXJlIER1bmsgSGVyb2VzIChKKS5uZXM=&t=%E7%83%AD%E8%A1%80%E7%AF%AE%E7%90%83&ac=3&p=/fcpic/ydbs/1548a.png",
            "https://www.yikm.net/play?id=4719&n=L2Zjcm9tL3lkYnMvUmVuZWdhZGUgKFUpIFshXS5uZXM=&t=%E7%83%AD%E8%A1%80%E7%A1%AC%E6%B4%BE(%E7%BE%8E%E7%89%88)&ac=3&p=/fcpic/ydbs/2230a.png",
            "https://www.yikm.net/play?id=3487&n=L2Zjcm9tL2R6bXgvU2FpeXV1a2kgV29ybGQgMiAtIFRlbmpvdWthaSBubyBNYWppbiAoSikubmVz&t=%E8%A5%BF%E6%B8%B8%E8%AE%B02(%E6%97%A5%E7%89%88)&ac=3&p=/fcpic/1881a.png",
            "https://www.yikm.net/play?id=3321&n=L2Zjcm9tL2R6bXgvTWlnaHR5IEZpbmFsIEZpZ2h0IChKKSBbIV0ubmVz&t=%E5%BF%AB%E6%89%93%E6%97%8B%E9%A3%8E&ac=3&p=/fcpic/1455a.png"};
    private SmartRefreshLayout smartRefreshLayout;
    private TextView title, enflish_titile;
    private ObjectAnimator animator;
    private ElasticImageView Image_1, Image_2, Image_3, Image_4, Image_5, Image_6, Image_7, Image_8, Image_9, Image_10, Image_11, Image_12, Image_13, Image_14, Image_15, Image_16;
    private ElasticButton Game_1, Game_2, Game_3, Game_4, Game_5, Game_6, Game_7, Game_8, Game_9, Game_10, Game_11, Game_12, Game_13, Game_14, Game_15, Game_16;
    private LinearLayout Root;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_game);
        //vpn检测
        VPNActivity vpnActivity = new VPNActivity(this);
        ButterKnife.bind(this);
        //全屏
        ImmersionBar.with(this).hideBar(BarHide.FLAG_HIDE_BAR).fullScreen(true).init();
        //其他控件初始化
        smartRefreshLayout = findViewById(R.id.smart);
        smartRefreshLayout.setEnablePureScrollMode(true);
        smartRefreshLayout.setEnableLoadMore(true);

        title = findViewById(R.id.title);
        enflish_titile = findViewById(R.id.english_title);
        title.setTypeface(Typeface.createFromAsset(this.getAssets(), "rubik.ttf"));
        animator = ObjectAnimator.ofFloat(title, "translationX", -100f, 0f, 100f, 0f);
        animator.setDuration(2600);
        animator.start();
        enflish_titile.setTypeface(Typeface.createFromAsset(this.getAssets(), "space.ttf"));
        animator = ObjectAnimator.ofFloat(enflish_titile, "translationX", -100f, 0f, 100f, 0f);
        animator.setDuration(2600);
        animator.start();

        Root = findViewById(R.id.Root);
        animator = ObjectAnimator.ofFloat(Root, "alpha", 0f, 1f);
        animator.setDuration(2600);
        animator.start();
        Image_1 = findViewById(R.id.Image_1);
        Image_1.setImageResource(R.mipmap.kundou);
        Image_2 = findViewById(R.id.Image_2);
        Image_2.setImageResource(R.mipmap.chaoji);
        Image_3 = findViewById(R.id.Image_3);
        Image_3.setImageResource(R.mipmap.gui);
        Image_4 = findViewById(R.id.Image_4);
        Image_4.setImageResource(R.mipmap.xue);
        Image_5 = findViewById(R.id.Image_5);
        Image_5.setImageResource(R.mipmap.tanke);
        Image_6 = findViewById(R.id.Image_6);
        Image_6.setImageResource(R.mipmap.mao);
        Image_7 = findViewById(R.id.Image_7);
        Image_7.setImageResource(R.mipmap.ged);
        Image_8 = findViewById(R.id.Image_8);
        Image_8.setImageResource(R.mipmap.hun);
        Image_9 = findViewById(R.id.Image_9);
        Image_9.setImageResource(R.mipmap.ged2);
        Image_10 = findViewById(R.id.Image_10);
        Image_10.setImageResource(R.mipmap.m3);
        Image_11 = findViewById(R.id.Image_11);
        Image_11.setImageResource(R.mipmap.reuw);
        Image_12 = findViewById(R.id.Image_12);
        Image_12.setImageResource(R.mipmap.zuqiu);
        Image_13 = findViewById(R.id.Image_13);
        Image_13.setImageResource(R.mipmap.lan);
        Image_14 = findViewById(R.id.Image_14);
        Image_14.setImageResource(R.mipmap.hb);
        Image_15 = findViewById(R.id.Image_15);
        Image_15.setImageResource(R.mipmap.xy);
        Image_16 = findViewById(R.id.Image_16);
        Image_16.setImageResource(R.mipmap.lxj);

        Game_1 = findViewById(R.id.Game_1);
        Game_2 = findViewById(R.id.Game_2);
        Game_3 = findViewById(R.id.Game_3);
        Game_4 = findViewById(R.id.Game_4);
        Game_5 = findViewById(R.id.Game_5);
        Game_6 = findViewById(R.id.Game_6);
        Game_7 = findViewById(R.id.Game_7);
        Game_8 = findViewById(R.id.Game_8);
        Game_9 = findViewById(R.id.Game_9);
        Game_10 = findViewById(R.id.Game_10);
        Game_11 = findViewById(R.id.Game_11);
        Game_12 = findViewById(R.id.Game_12);
        Game_13 = findViewById(R.id.Game_13);
        Game_14 = findViewById(R.id.Game_14);
        Game_15 = findViewById(R.id.Game_15);
        Game_16 = findViewById(R.id.Game_16);

        Game_1.setOnClickListener(this::onClick);
        Game_2.setOnClickListener(this::onClick);
        Game_3.setOnClickListener(this::onClick);
        Game_4.setOnClickListener(this::onClick);
        Game_5.setOnClickListener(this::onClick);
        Game_6.setOnClickListener(this::onClick);
        Game_7.setOnClickListener(this::onClick);
        Game_8.setOnClickListener(this::onClick);
        Game_9.setOnClickListener(this::onClick);
        Game_10.setOnClickListener(this::onClick);
        Game_11.setOnClickListener(this::onClick);
        Game_12.setOnClickListener(this::onClick);
        Game_13.setOnClickListener(this::onClick);
        Game_14.setOnClickListener(this::onClick);
        Game_15.setOnClickListener(this::onClick);
        Game_16.setOnClickListener(this::onClick);
    }

    @SuppressLint("NonConstantResourceId")
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.Game_1:
                Intent intent1 = new Intent();
                intent1.putExtra("网址", UrlData[0]);
                intent1.setClass(Game.this, GameWeb.class);
                startActivity(intent1);
                overridePendingTransition(R.anim.activity_visible, R.anim.activity_gone);
                //播放音频
                Music();
                break;
            case R.id.Game_2:
                Intent intent2 = new Intent();
                intent2.putExtra("网址", UrlData[1]);
                intent2.setClass(Game.this, GameWeb.class);
                startActivity(intent2);
                overridePendingTransition(R.anim.activity_visible, R.anim.activity_gone);
                //播放音频
                Music();
                break;
            case R.id.Game_3:
                Intent intent3 = new Intent();
                intent3.putExtra("网址", UrlData[2]);
                intent3.setClass(Game.this, GameWeb.class);
                startActivity(intent3);
                overridePendingTransition(R.anim.activity_visible, R.anim.activity_gone);
                //播放音频
                Music();
                break;
            case R.id.Game_4:
                Intent intent4 = new Intent();
                intent4.putExtra("网址", UrlData[3]);
                intent4.setClass(Game.this, GameWeb.class);
                startActivity(intent4);
                overridePendingTransition(R.anim.activity_visible, R.anim.activity_gone);
                //播放音频
                Music();
                break;
            case R.id.Game_5:
                Intent intent5 = new Intent();
                intent5.putExtra("网址", UrlData[4]);
                intent5.setClass(Game.this, GameWeb.class);
                startActivity(intent5);
                overridePendingTransition(R.anim.activity_visible, R.anim.activity_gone);
                //播放音频
                Music();
                break;
            case R.id.Game_6:
                Intent intent6 = new Intent();
                intent6.putExtra("网址", UrlData[5]);
                intent6.setClass(Game.this, GameWeb.class);
                startActivity(intent6);
                overridePendingTransition(R.anim.activity_visible, R.anim.activity_gone);
                //播放音频
                Music();
                break;
            case R.id.Game_7:
                Intent intent7 = new Intent();
                intent7.putExtra("网址", UrlData[6]);
                intent7.setClass(Game.this, GameWeb.class);
                startActivity(intent7);
                overridePendingTransition(R.anim.activity_visible, R.anim.activity_gone);
                //播放音频
                Music();
                break;
            case R.id.Game_8:
                Intent intent8 = new Intent();
                intent8.putExtra("网址", UrlData[7]);
                intent8.setClass(Game.this, GameWeb.class);
                startActivity(intent8);
                overridePendingTransition(R.anim.activity_visible, R.anim.activity_gone);
                //播放音频
                Music();
                break;
            case R.id.Game_9:
                Intent intent9 = new Intent();
                intent9.putExtra("网址", UrlData[8]);
                intent9.setClass(Game.this, GameWeb.class);
                startActivity(intent9);
                overridePendingTransition(R.anim.activity_visible, R.anim.activity_gone);
                //播放音频
                Music();
                break;
            case R.id.Game_10:
                Intent intent10 = new Intent();
                intent10.putExtra("网址", UrlData[9]);
                intent10.setClass(Game.this, GameWeb.class);
                startActivity(intent10);
                overridePendingTransition(R.anim.activity_visible, R.anim.activity_gone);
                //播放音频
                Music();
                break;
            case R.id.Game_11:
                Intent intent11 = new Intent();
                intent11.putExtra("网址", UrlData[10]);
                intent11.setClass(Game.this, GameWeb.class);
                startActivity(intent11);
                overridePendingTransition(R.anim.activity_visible, R.anim.activity_gone);
                //播放音频
                Music();
                break;
            case R.id.Game_12:
                Intent intent12 = new Intent();
                intent12.putExtra("网址", UrlData[11]);
                intent12.setClass(Game.this, GameWeb.class);
                startActivity(intent12);
                overridePendingTransition(R.anim.activity_visible, R.anim.activity_gone);
                //播放音频
                Music();
                break;
            case R.id.Game_13:
                Intent intent13 = new Intent();
                intent13.putExtra("网址", UrlData[12]);
                intent13.setClass(Game.this, GameWeb.class);
                startActivity(intent13);
                overridePendingTransition(R.anim.activity_visible, R.anim.activity_gone);
                //播放音频
                Music();
                break;
            case R.id.Game_14:
                Intent intent14 = new Intent();
                intent14.putExtra("网址", UrlData[13]);
                intent14.setClass(Game.this, GameWeb.class);
                startActivity(intent14);
                overridePendingTransition(R.anim.activity_visible, R.anim.activity_gone);
                //播放音频
                Music();
                break;
            case R.id.Game_15:
                Intent intent15 = new Intent();
                intent15.putExtra("网址", UrlData[14]);
                intent15.setClass(Game.this, GameWeb.class);
                startActivity(intent15);
                overridePendingTransition(R.anim.activity_visible, R.anim.activity_gone);
                //播放音频
                Music();
                break;
            case R.id.Game_16:
                Intent intent16 = new Intent();
                intent16.putExtra("网址", UrlData[15]);
                intent16.setClass(Game.this, GameWeb.class);
                startActivity(intent16);
                overridePendingTransition(R.anim.activity_visible, R.anim.activity_gone);
                //播放音频
                Music();
                break;
        }
    }

    //播放音乐
    public void Music() {
        MediaPlayer mediaPlayer = MediaPlayer.create(this, R.raw.a);
        mediaPlayer.start();
    }

}